import {request} from './request.js'

export function getDetail(id) {
	return request({
		url:'/api/getArticlesDetail/'+id
	})
}

export function getComment(art_id) {
	return request({
		url:'/api/comment/get/' + art_id
	})
}

export function postComment(art_id,content,token) {
	return request({
		url:'/my/comment/add',
		method: 'post',
		data:{
			art_id: art_id,
			cmt_content:content
		},
		transformRequest: [function(data) {
		                let ret = ''
		                for(let it in data) {
		                    ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&'
		                }
		                return ret
		            }],
		headers: {
		        'Content-Type': 'application/x-www-form-urlencoded',
				'Authorization': token
		}
	})
}